<?php

namespace Common\Service\Statis;
use Common\Service\BaseService;

// +----------------------------------------------------------------------
// | 文件 LogStatisItemService.class.php
// +----------------------------------------------------------------------
// | 说明 单项的统计计算结果
// +----------------------------------------------------------------------
// | 
// +----------------------------------------------------------------------
// | Author: 谢赤心 Legend. <xcx_legender@qq.com>
// +----------------------------------------------------------------------

Class LogStatisItemService extends BaseService
{


    /**
     
    object_type:  day
    object_class:  20160606
    object_data: []

     */

    public function getDailyData($date)
    {   
        if ($data == date('Ymd')){
            // 当天 不计算;
            return;
        }

        $map = ['object_type' => 'day', 'object_date' => strval($date)];
        if ($result = $this->where($map)->find()){
            return $result['object_data'];
        }else{
            $logServ = service('ImbaLog/LogSource');
            $object_data = $logServ->calculteFromLog($date);
            if ($object_data){
                $result = $map;
                $result['object_data'] = $object_data;
                // print_r($result);
                $this->add($result);
                return $object_data;
            }else{
                return;
            }
        }
    }

}